<?php

use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|web.php 文件包含的路由通过 RouteServiceProvider 引入，都被约束在 web 中间件组中，
因而支持 Session、CSRF 保护以及 Cookie 加密功能，如果应用无需提供无状态的、RESTful 风格的 API，
那么路由基本上都要定义在 web.php 文件中。
*/

Route::get('/test/{catid}','TestController@test');
Route::get('ordertest', 'OrderController@index');
//Index 模块分组路由
Route::group(['namespace'=>'Index'],function (){
    Route::get('/','Index@index');
    Route::get('/goods/lists/{catid?}/{name?}','Goods@lists')->where(['catid' => '[0-9]+']);
    Route::get('/goods/details/{id}','Goods@details')->where(['catid' => '[0-9]+']);
    Route::get('/cart','Cart@index');
    Route::any('/addCart','Cart@addCart');
    Route::any('/allCarts','Cart@allCarts');
    Route::any('/delCarts','Cart@delCarts');
    Route::any('/updateCarts','Cart@updateCarts');
    Route::get('/user','User@index');
    Route::get('/login','Login@index')->name('login');
    Route::get('/logout','User@logout');
    Route::post('/check','Login@check');
    Route::post('/sendSMS','Login@sendSMS');
    Route::get('/getGoodsSkuBySkuSpeciValueId','GoodsSku@getGoodsSkuBySkuSpeciValueId');

    Route::resource('order', 'order');
    Route::get('pay', 'Pay@index');


});


//Admin 模块分组路由
Route::group(['namespace'=>'Admin','middleware'=>'auth'],function (){
    Route::get('/admin/index','IndexController@index');

    //商品模块
    Route::get('admin/goods/goods','Goods\GoodsController@goods');
    Route::any('admin/goods/add','Goods\GoodsController@add');
    Route::any('admin/goods/addGoods','Goods\GoodsController@addGoods');
    Route::get('admin/goods/category','Goods\GoodsController@category');
    Route::get('admin/goods/category/lists','Goods\CategoryController@lists');
    Route::post('admin/goods/category/add','Goods\CategoryController@add');
    Route::post('admin/goods/category/edit','Goods\CategoryController@edit');
    Route::post('admin/goods/category/del','Goods\CategoryController@del');
    Route::get('admin/goods/category/lists1','Goods\CategoryController@lists1');
    Route::get('admin/goods/category/getTree','Goods\CategoryController@getTree');
    Route::get('admin/goods/speci','Goods\GoodsController@speci');
    Route::get('admin/goods/speci/lists','Goods\SpeciController@lists');
    Route::any('admin/goods/speci/getSpeciValues','Goods\SpeciController@getSpeciValues');
    Route::post('admin/goods/upload','Goods\UploadController@upload');



});




Route::get('admin/login','AdminLoginController@login')->name('login');
Route::post('admin/check','AdminLoginController@check');


